<template>
  <div class="dashboard-editor-container">
    <el-row>
      <!--<el-col :span="8">-->
      <!--<div class="myPanel">-->
      <!--<div class="left">-->
      <!--<el-tooltip class="item mg_bottom15" effect="dark" content="Left Top 提示文字" placement="left-start">-->
      <!--<el-card :body-style="{padding: '0 15px'}" class="box-card">-->
      <!--<div class="text _item">-->
      <!--<p>注册用户量:{{ list.AllRegisteredUsers }}</p>-->
      <!--<p>完善信息用户量:{{ list.PerfectEverythingUser }}</p>-->
      <!--</div>-->
      <!--</el-card>-->
      <!--</el-tooltip>-->
      <!--<el-tooltip class="item mg_bottom15" effect="dark" content="Left Center 提示文字" placement="left">-->
      <!--<el-card :body-style="{padding: '0 15px'}" class="box-card">-->
      <!--<div class="text _item">-->
      <!--<p>访问开店宣传页面用户量:{{ list.PublicityPageUserNumber }}</p>-->
      <!--<p>访问开店步骤页面用户量:{{ list.StepPageUserNumber }}</p>-->
      <!--</div>-->
      <!--</el-card>-->
      <!--</el-tooltip>-->
      <!--<el-tooltip class="item" effect="dark" content="Left Bottom 提示文字" placement="left-end">-->
      <!--<el-card :body-style="{padding: '0 15px'}" class="box-card">-->
      <!--<div class="text _item">-->
      <!--<p>通过审核商家:{{ list.pass_merchant_count }}</p>-->
      <!--<p>未审核商家:{{ list.failed_merchant_count }}</p>-->
      <!--<p>审核中商家:{{ list.audit_merchant_count }}</p>-->
      <!--<p>审核失败商家:{{ list.unreviewed_merchant_count }}</p>-->
      <!--</div>-->
      <!--</el-card>-->
      <!--</el-tooltip>-->
      <!--</div>-->
      <!--</div>-->
      <!--</el-col>-->
      <el-col :offset="1">
        <div class="chart-wrapper chart-wrapper-right">
          <PanelGroup />
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { getIndexList } from '@/api/merchant/merchant'
import store from '@/store'
import GithubCorner from '@/components/GithubCorner'
import PanelGroup from './components/PanelGroup'
import LineChart from './components/LineChart'
import RaddarChart from './components/RaddarChart'
import PieChart from './components/PieChart'
import BarChart from './components/BarChart'
import TransactionTable from './components/TransactionTable'
import TodoList from './components/TodoList'
import BoxCard from './components/BoxCard'

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'DashboardAdmin',
  components: {
    GithubCorner,
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart,
    TransactionTable,
    TodoList,
    BoxCard
  },
  data() {
    return {
      list: [],
      lineChartData: lineChartData.newVisitis,
      listQuery: {
        AllRegisteredUsers: undefined,
        PerfectEverythingUser: undefined,
        PublicityPageUserNumber: undefined,
        StepPageUserNumber: undefined,
        pass_merchant_count: undefined,
        failed_merchant_count: undefined,
        audit_merchant_count: undefined,
        unreviewed_merchant_count: undefined,
        page: 1,
        limit: 20
      }
    }
  },
  created() {
    this.getLists()
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    },
    getLists() {
      this.listLoading = true
      getIndexList(store.getters.token, this.listQuery).then(response => {
        this.list = response.data.list
        console.log(111)
        console.log(this.list)
        this.total = response.data.list.total
        this.listLoading = false
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  /*padding: 32px;*/
  /*background-color: rgb(240, 242, 245);*/
  position: relative;

  .github-corner {
    position: absolute;
    top: 0;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }

  .chart-wrapper-right{
    /*width: 700px;*/
    height: 530px;
    background:#fff;
    padding:16px 16px 0;
    margin-bottom:32px;
  }
}
</style>
<style>
  .myPanel .panel-group{
    display: flex;
    flex-direction: column;
    min-width: 100px;
  }
  .left {
    float: left;
    width: 500px;
    height: 530px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .item{
    flex: 1;
  }
  .mg_bottom15{
    margin-bottom: 15px;
  }
</style>
